﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Model
{
    [MessageHandler(AppType.Realm)]
    public class GetRoomListHandle : AMRpcHandler<C2M_GetRoomList, M2C_GetRoomList>
    {
        protected override void Run(Session session, C2M_GetRoomList message, Action<M2C_GetRoomList> reply)
        {
            Log.Debug("GetRoomList");
            M2C_GetRoomList response = new M2C_GetRoomList();
            try
            {
                response.RoomList = Game.Scene.GetComponent<RoomManagerComponent>().RoomList;
                reply(response);
            }
            catch (Exception e)
            {
                ReplyError(response, e, reply);
            }
        }
    }
}
